﻿using Mes.Application.DTO.Inputs.Operations;
using Mes.Application.DTO.Inputs.WorkOrders;
using Mes.Application.DTO.Results.Operations;
using Mes.Application.DTO.Results.WorkOrders;
using Mes.Domain.BoundedContext;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mes.Application.Services.WorkOrders
{
    public interface IWoService
    {
        /// <summary>
        /// 通过工艺新增工单，此接口会将工艺及其下的工序，以及工序下的BOM、Entity、StepGrp和StepGrp下的Step转换为工单及其下作业和作业的一些关联表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task AddWoByProcessAsync(WoInputWithProcess input);

        /// <summary>
        /// 新增工单
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task AddWoAsync(AddWoInput input);

        /// <summary>
        /// 编辑工单
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task UpdateWoAsync(UpdateWoInput input);

        /// <summary>
        /// 删除工单
        /// </summary>
        /// <param name="wo_Id">工单Id</param>
        /// <returns></returns>
        Task DeleteWoAsync(string wo_Id);

        /// <summary>
        /// 分页查询工单列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PagedItemsData<WosResult>> GetWosAsync(GetWosInput input);

        /// <summary>
        /// 查询工单实体
        /// </summary>
        /// <param name="wo_Id"></param>
        /// <returns></returns>
        Task<WoResult> GetWoAsync(string wo_Id);

        /// <summary>
        /// 查询所有工艺的物料和物料清单
        /// </summary>
        /// <returns></returns>
        Task<ItemsResult<ProcessForWoResult>> GetAllProcessesMaterialMaterialBOMAsync();

        /// <summary>
        /// 查询工艺关联的待生产物料，以及待生产物料对应的BOM和BOM下的物料列表
        /// </summary>
        /// <param name="processId"></param>
        /// <returns></returns>
        Task<MaterialBOMResults> GetProcessMaterialBOMAsync(string processId);

        /// <summary>
        /// 移动作业的位置
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task MovingJobSequenceAsync(MovingJobSequenceInput input);

        /// <summary>
        /// 查询某个工单的路线信息，按顺序显示作业的操作编号
        /// </summary>
        /// <param name="wo_Id">工单编号</param>
        /// <returns></returns>
        Task<ItemsResult<WoJobRoutesResult>> GetWoJobRoutesAsync(string wo_Id);
    }
}
